import java.sql.*;
//inserting object into database table
class JdbcDemo30 {
	public static void main(String args[]) throws Exception
	{
		Class.forName("oracle.jdbc.driver.OracleDriver");
		Connection cn = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe","kushwaha","oracle");
		PreparedStatement ps=cn.prepareStatement("insert into person values(?,?)");
		Address a=new Address();
		a.setAddress(102, "nagar", "Hyrabad", "AP");
		ps.setString(1, "Rama");
		ps.setObject(2, a);
		int count = ps.executeUpdate();
		System.out.println(count+ "rows inserted");
		ps.close();
		cn.close();
	}

}
